package org.raymond.iworks.study.testframework;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.*;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

@Slf4j
@Tag("hello")
public class StandardTests {
    @BeforeAll
    static void beforeAll(){
        log.info("beforeAll");
    }
    @BeforeEach
    void beforeEach(){
        log.info("beforeEach");
    }
    @Test
    void successTest(){
        log.info("success test");
    }
    @Test
    void failTest(){
        fail("failing test");
    }
    @Test
    @Disabled("should not be executed.")
    void skippedTest() {
        log.info("skippedTest");
    }
    @AfterEach
    void tearDown() {
        log.info("tearDown");
    }

    @AfterAll
    static void tearDownAll() {
        log.info("tearDownAll");
    }

    // Assertions的方法抛出异常意味着测试不通过，Assumptions的方法抛出异常意味着测试被跳过
    @Test
    void assertFalse(){
        log.info("assertFalse");
        assertTrue(false, "断言false,测试不通过");
    }

    @Test
    @Tag("assump")
    void assumpFalse(){
        log.info("asssumpFalse");
        Assumptions.assumeFalse(false, "假设false,测试跳过");
    }
}
